//
//  CommentViewController.m
//  半糖
//
//  Created by RenShuang on 15/9/17.
//  Copyright (c) 2015年 shuang. All rights reserved.
//

#import "CommentViewController.h"
#import "BaseHeader.h"

@interface CommentViewController ()<UIWebViewDelegate>

@property(nonatomic,retain)UIWebView *myWebView;
@property(nonatomic,retain)UIActivityIndicatorView *activity;

@end

@implementation CommentViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = @"好物详情";
    
    self.myWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, -44, SCREEN_WIDTH, SCREEN_HEIGHT+44)];
    [self.myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.urlStr]]];
    self.myWebView.scrollView.bounces = NO;
    self.myWebView.delegate = self;
    _myWebView.scrollView.showsVerticalScrollIndicator = NO;
    self.myWebView.scalesPageToFit = YES;
    [self.view addSubview:self.myWebView];
    [_myWebView release];
    
    self.activity = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    _activity.center = self.view.center;
    [self.view addSubview:self.activity];
    [_activity release];
    
}

- (void)webViewDidStartLoad:(UIWebView *)webView
{
    [self.activity startAnimating];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [self.activity stopAnimating];
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    [self.activity stopAnimating];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
